function timeout(name,num) {
    setTimeout(function(){
        console.log(name, '已经完成')
    },num * 1000);
}

// async await方式
async function testResult() {
    var start_time = (new Date().getTime()) / 1000
    let result1 = await timeout('A', 2)
    let result2 = await timeout('B', 3)
    var end_time = (new Date().getTime()) / 1000
    console.log('完成时间：', end_time - start_time)
}

testResult()